package com.example.pclimb.model;

import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.Ignore;
import androidx.room.Index;
import androidx.room.PrimaryKey;

/**
 * 向导证书图片实体类
 * 用于存储陪爬向导申请时上传的证书图片
 */
@Entity(tableName = "guide_images",
        foreignKeys = @ForeignKey(entity = User.class,
                parentColumns = "id",
                childColumns = "userId",
                onDelete = ForeignKey.CASCADE),
        indices = {@Index("userId")})
public class GuideImage {

    @PrimaryKey(autoGenerate = true)
    private int id;

    private int userId;    // 关联的用户ID
    private String imagePath;  // 图片本地路径
    private String imageUrl;   // 图片远程URL（如果有）
    private long uploadTime;   // 上传时间

    public GuideImage() {
    }

    @Ignore
    public GuideImage(int userId, String imagePath) {
        this.userId = userId;
        this.imagePath = imagePath;
        this.uploadTime = System.currentTimeMillis();
    }

    // Getters and Setters
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getImagePath() {
        return imagePath;
    }

    public void setImagePath(String imagePath) {
        this.imagePath = imagePath;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public long getUploadTime() {
        return uploadTime;
    }

    public void setUploadTime(long uploadTime) {
        this.uploadTime = uploadTime;
    }

    @Override
    public String toString() {
        return "GuideImage{" +
                "id=" + id +
                ", userId=" + userId +
                ", imagePath='" + imagePath + '\'' +
                ", imageUrl='" + imageUrl + '\'' +
                ", uploadTime=" + uploadTime +
                '}';
    }
} 